package com.rtuwrapper.messaging;

import com.rtuwrapper.processing.Integer16;
import com.rtuwrapper.processing.Register;

import static com.rtuwrapper.ModbusConstants.READ_REGISTER;

public class ReadIntegerResponse extends BaseResponse<Integer16, Integer> {

    public ReadIntegerResponse(byte[] message) {
        super(READ_REGISTER, message);
    }

    @Override
    public Integer16 decodeMessage(byte[] message) {
        int value = getMessageProcessor().getReadResponseValue(message, false);
        return new Integer16(-1, value);
    }
}
